Skip to content

Add the "memoize" attribute to the node macro#4065

Merged
Keavon merged 2 commits intomasterfrom
memoize-attribute
Apr 28, 2026
Merged

Add the "memoize" attribute to the node macro#4065
Keavon merged 2 commits intomasterfrom
memoize-attribute

Conversation

@TrueDoctor
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a memoize attribute to the node macro, enabling automatic caching for specific nodes. The changes include updating the NodeMetadata struct, enhancing the macro's parsing and code generation to handle the new attribute, and modifying the preprocessor to insert a Memo node into the subnetwork when memoization is enabled. Additionally, the sample_polyline node has been updated to utilize this feature. I have no feedback to provide.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 6 files

Confidence score: 3/5

  • There is a concrete medium-severity risk in node-graph/preprocessor/src/lib.rs: when generated_nodes == 0, the memoize flag is ignored, so expected Memo nodes are not appended.
  • Because this affects memoized nodes without conversion wrappers, behavior can regress in real graph execution paths, which makes this more than a minor housekeeping issue.
  • Given the high confidence (9/10) and clear functional impact, this looks like some merge risk rather than a merge blocker.
  • Pay close attention to node-graph/preprocessor/src/lib.rs - ensure Memo node insertion still occurs for memoized nodes even when no conversion nodes are generated.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="node-graph/preprocessor/src/lib.rs">

<violation number="1" location="node-graph/preprocessor/src/lib.rs:131">
P2: `memoize` is ignored when `generated_nodes == 0`, so memoized nodes without conversion wrappers never get the Memo node appended.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread node-graph/preprocessor/src/lib.rs
@Keavon Keavon changed the title Add memoization attribute to node macro Add the "memoize" attribute to the node macro Apr 28, 2026
@Keavon Keavon added this pull request to the merge queue Apr 28, 2026
Merged via the queue into master with commit e7f0703 Apr 28, 2026
10 of 11 checks passed
@Keavon Keavon deleted the memoize-attribute branch April 28, 2026 11:56
Keavon pushed a commit that referenced this pull request Apr 29, 2026
* Add memoization attribute to node macro

* Fix memoization insertion for networks without conversion nodes
oluseyi pushed a commit to oluseyi/Graphite that referenced this pull request Apr 29, 2026
* Add memoization attribute to node macro

* Fix memoization insertion for networks without conversion nodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants